package com.cloud.bc.model.enums;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public enum PhotoEnum {
    ALBUM("album", "相册"),
    FACEPHOTOPREVIEWS("face_photo-previews","正面人脸照"),
    IDCARDPOSITIVEPHOTOPREVIEWS("id_card_positive_photo-previews","身份证人像面"),
    IDCARDBACKPHOTOPREVIEWS("id_card_back_photo-previews","身份证国徽面"),
    EDUCATIONPICPREVIEWS("education_pic-previews","学历证书"),
    WORKPICPREVIEWS("work_pic-previews","工作证书"),
    HAUSEPICPREVIEWS("hause_pic-previews","房产证书"),
    CARPICPREVIEWS("car_pic-previews","汽车证书"),

    ;
    private String title;
    private String desc;

    PhotoEnum(String title, String desc) {
        this.title = title;
        this.desc = desc;
    }

    public String getTitle() {
        return title;
    }

    public String getDesc() {
        return desc;
    }

    public static PhotoEnum getEnumDesc(String desc) {
        for (PhotoEnum c : PhotoEnum.values()) {
            if (c.getDesc().equals(desc)) {
                return c;
            }
        }
        return null;
    }

    public static PhotoEnum getEnumTitle(String title) {
        for (PhotoEnum c : PhotoEnum.values()) {
            if (c.getTitle().equals(title)) {
                return c;
            }
        }
        return null;
    }

    public static List<Map<String, String>> getAllEnum() {
        List<Map<String, String>> list = new ArrayList<>();
        for (PhotoEnum c : PhotoEnum.values()) {
            Map<String, String> map = new HashMap<String, String>();
            map.put("value", c.getTitle() + "");
            map.put("label", c.getDesc());
            list.add(map);
        }
        return list;
    }
}
